package com.orange.cloud.common.core.msg;

import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: ability-platform
 * @description:
 * @author: wsw
 * @create: 2020-07-29 10:45
 **/
public class Headers {

    /**
     * rest 设置请求头
     * @return
     */
    public static HttpHeaders getJsonHeaders() {
        HttpHeaders headers = new HttpHeaders();
        List<MediaType> mediaTypeList = new ArrayList<>();
        mediaTypeList.add(MediaType.APPLICATION_JSON);
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.setAccept(mediaTypeList);
        return headers;
    }

    /**
     * rest 设置请求头
     * @return
     */
    public static HttpHeaders getFormHeaders() {
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        return headers;
    }
}
